package org.ehe.finance.voucher.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.ehe.common.mybatis.core.page.PageQuery;
import org.ehe.common.mybatis.core.page.TableDataInfo;
import org.ehe.finance.voucher.domain.ErpFinanceVoucherType;
import org.ehe.finance.voucher.domain.bo.VoucherTypeCreateBo;
import org.ehe.finance.voucher.domain.bo.VoucherTypeQueryBo;
import org.ehe.finance.voucher.domain.bo.VoucherTypeUpdateBo;
import org.ehe.finance.voucher.domain.vo.ErpFinanceVoucherTypeVo;

import java.util.List;

/**
 * @author :zhangnn
 * @className :ErpFinanceVoucherTypeService
 * @description: TODO
 * @date 2025-08-22 17:47:00
 */
public interface ErpFinanceVoucherTypeService extends IService<ErpFinanceVoucherType> {

    /**
     * 分页查询凭证类别
     */
    TableDataInfo<ErpFinanceVoucherTypeVo> pageVoucherTypes(VoucherTypeQueryBo bo, PageQuery pageQuery);

    /**
     * 创建凭证类别
     */
    Long createVoucherType(VoucherTypeCreateBo createDTO);

    /**
     * 更新凭证类别
     */
    void updateVoucherType(VoucherTypeUpdateBo updateDTO);

    /**
     * 删除凭证类别
     */
    void deleteVoucherType(Long id);

    /**
     * 批量删除凭证类别
     */
    void batchDeleteVoucherTypes(List<Long> ids);

    /**
     * 根据ID获取凭证类别详情
     */
    ErpFinanceVoucherTypeVo getVoucherTypeById(Long id);

    /**
     * 获取启用的凭证类别列表
     */
    List<ErpFinanceVoucherTypeVo> getEnabledVoucherTypes();

    /**
     * 启用/禁用凭证类别
     */
    void changeStatus(Long id, Integer status);

    /**
     * 检查编码是否存在
     */
    boolean checkTypeCodeExists(String typeCode, Long excludeId);

    /**
     * 检查凭证字是否存在
     */
    boolean checkPrefixExists(String prefix, Long excludeId);

    /**
     * 生成凭证号
     */
    String generateVoucherNo(Long voucherTypeId, String period);

    String[] parseSourceVoucherNo(String voucherNo);

    int calculateNewSubSerial(String mainVoucherNo);
}
